package org.openrbac.rbac.handler;

import lombok.extern.slf4j.Slf4j;
import org.openrbac.rbac.vo.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author bapie
 */
@Slf4j
@ResponseBody
@ControllerAdvice
public class ControllerExceptionHandler {
    @ExceptionHandler(Exception.class)
    public R<Object> exceptionHandler(Exception exception) {
        log.error(exception.getMessage());
        return R.error(exception.getMessage());
    }
}
